<template>
	<view @click="navigate('/page_pack/seed/detail?id='+info.id)" class="seed-item" :style="style">
		<image :src="info.coverImage" mode="aspectFill" class="seed-cover"></image>
		<view class="seed-info">
			<view class="title">{{info.title}}</view>
			<view class="description">{{info.account||''}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'FoodItem',
		computed: {
			style() {
				return this.background == 'rgba(0,0,0,0)' ? 'border-bottom:1px solid #e7e7e7;margin:0rpx;background:' +
					this.background : 'background:' + this.background;
			}
		},
		props: {
			background: {
				type: String,
				default: 'rgba(0,0,0,0)'
			},
			info: {
				type: Object,
				default: () => {
					return {
						coverImage: '',
						title: '',
						address: '',
						distance: '未知',
					}
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.seed-item {
		width: 100%;
		height: 220rpx;
		border-radius: 8px;
		background: #fff;
		display: flex;
		align-items: center;
		padding: 30rpx;
		margin-bottom: 20rpx;

		.seed-cover {
			width: 160rpx;
			height: 160rpx;
			border-radius: 8px;
			margin-right: 20rpx;
		}

		.seed-info {
			width: calc(100% - 180rpx);
			height: 100%;
			display: flex;
			flex-direction: column;
			justify-content: center;

			.title {
				width: 100%;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
				font-size: 34rpx;
				font-weight: bold;
				margin-bottom: 40rpx;
			}

			.description {
				width: 100%;
				font-size: 28rpx;
				color: #999;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}
	}
</style>